From 42fd3b74608ed6e9d35021ca5cfdffe2d0d6b8d1 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Sat, 4 Sep 2004 23:04:53 +0000 Subject: [PATCH] bitkeeper revision 1.1159.69.12 (413a4a15Z23E3TdWcslHMKLH4O-Gww) Fix timestamp-scaling calculations in Linux 2.4. Time now progresses at the correct rate! --- linux-2.4.27-xen-sparse/arch/xen/kernel/time.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c b/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c index a2ffce3039..924a4a8efe 100644 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c @@ -604,12 +604,15 @@ static struct irqaction dbg_time = { void __init time_init(void) { unsigned long long alarm; - u64 __cpu_khz, cpu_freq, scale, scale2; + u64 __cpu_khz, __cpu_ghz, cpu_freq, scale, scale2; unsigned int cpu_ghz; - __cpu_khz = HYPERVISOR_shared_info->cpu_freq; - do_div(__cpu_khz, 1000); + __cpu_khz = __cpu_ghz = cpu_freq = HYPERVISOR_shared_info->cpu_freq; + do_div(__cpu_khz, 1000UL); cpu_khz = (u32)__cpu_khz; + do_div(__cpu_ghz, 1000000000UL); + cpu_ghz = (unsigned int)__cpu_ghz; + printk("Xen reported: %lu.%03lu MHz processor.\n", cpu_khz / 1000, cpu_khz % 1000); @@ -617,9 +620,6 @@ void __init time_init(void) xtime.tv_usec = HYPERVISOR_shared_info->wc_usec; processed_system_time = shadow_system_time; - cpu_freq = HYPERVISOR_shared_info->cpu_freq; - - cpu_ghz = do_div(cpu_freq, 1000000000UL); for ( rdtsc_bitshift = 0; cpu_ghz != 0; rdtsc_bitshift++, cpu_ghz >>= 1 ) continue; -- 2.30.2